package org.zero.mapstruct.converter;

import lombok.experimental.UtilityClass;

import java.util.Objects;

/**
 * @author Zero (cnzeropro@qq.com)
 * @date 2022/11/5
 */
@UtilityClass
public class NumBoolConverter {
    public Boolean byte2Bool(Byte b) {
        if (Objects.isNull(b)) {
            return false;
        }
        return b == 1;
    }

    public Boolean short2Bool(Short s) {
        if (Objects.isNull(s)) {
            return false;
        }
        return s == 1;
    }

    public Boolean int2Bool(Integer i) {
        if (Objects.isNull(i)) {
            return false;
        }
        return i == 1;
    }

    public Boolean long2Bool(Long l) {
        if (Objects.isNull(l)) {
            return false;
        }
        return l == 1;
    }
}
